package ru.tapublog.lib.samsungwallet.impl.dao;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;

@XmlAccessorType(XmlAccessType.FIELD)
public class DateAlertDAO {
	@XmlElement(name="beforeinmin")
	private int beforeInMins;
	private String format;
	private String value;

	public DateAlertDAO() {
		this(null, null, 0);
	}

	public DateAlertDAO(String value, String format) {
		this(value, format, 0);
	}

	public DateAlertDAO(String value, String format, int beforeInMins) {
		setValue(value);
		setFormat(format);
		setBeforeInMins(beforeInMins);
	}

	public int getBeforeInMins() {
		return beforeInMins;
	}

	public void setBeforeInMins(int beforeInMins) {
		this.beforeInMins = beforeInMins;
	}

	public String getFormat() {
		return format;
	}

	public void setFormat(String format) {
		this.format = format;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + beforeInMins;
		result = prime * result + ((format == null) ? 0 : format.hashCode());
		result = prime * result + ((value == null) ? 0 : value.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		DateAlertDAO other = (DateAlertDAO) obj;
		if (beforeInMins != other.beforeInMins)
			return false;
		if (format == null) {
			if (other.format != null)
				return false;
		} else if (!format.equals(other.format))
			return false;
		if (value == null) {
			if (other.value != null)
				return false;
		} else if (!value.equals(other.value))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "DateAlertDAO [beforeInMins=" + beforeInMins + ", format="
				+ format + ", value=" + value + "]";
	}

}
